home *** CD-ROM | disk | FTP | other *** search
- Path: doors.informatik.uni-siegen.de!plrunu
- From: plrunu@informatik.uni-siegen.de (Runu Knips)
- Newsgroups: comp.lang.c,comp.lang.c++
- Subject: Re: HELP! On how to declare large arrays.
- Date: 15 Mar 1996 13:04:33 GMT
- Organization: University of Siegen
- Sender: plrunu@doors.informatik.uni-siegen.de (Runu Knips)
- Message-ID: <4ibpt1$br5@si-nic.hrz.uni-siegen.de>
- References: <lynch-1303962017180001@mac50.sask.trlabs.ca> <4ib40n$8of@moody.mchh.siemens.de>
- NNTP-Posting-Host: doors.informatik.uni-siegen.de
-
- Well, easy. You're using C/C++, so you can declare your array the following way:
- (assuming you're using int. Replace it with any other data type if you want)
-
- int *arr[512];
-
- Now construct the array with:
-
- for (int i = 512; i--;)
- arr[i] = new int[128];
-
- You can now use exactly the same syntax to access any array element in the
- array as if you had declared the array as int arr[512][128];
-
- Nevertheless, you may want to use a #ifdef __MSDOS__ or such, for this
- solution is a little bit slower than the 2-dim array solution.
-
- Ciao, Runu.
-
-
-